package com.xyy.saas.payment.common;

import com.xyy.saas.payment.cores.enums.BusinessIdTypeEnum;
import com.xyy.saas.payment.cores.enums.ChannelEnum;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

import java.util.Date;

/**
 * @author wangtianqi
 */
@Slf4j
public final class Constants {


    private Constants() {
    }
    /**
     * 下划线
     */
    public static final String UNDER_LINE = "_";
    /**
     * 支付平台自身ID
     */
    public static final String PAY_CENTER_ID = "payCenter";

    /**
     * 异常信息
     */
    public static final String URL_ILLEGAL = "URL不正常";

    /**
     * 数据库初始UNIX时间
     */
    public static final Long DEFAULT_UNIX_TIME = 0L;

    /**
     * 数据库默认Date
     */
    public static final Date DEFAULT_DATE = new Date(0L);

    /**
     * 传入的人民币最大值
     */
    public static final Integer MAX_AMOUNT =1000000000;
    /**
     * 超时时间最小
     */
    public static final Integer MIN_TIME_EXPIRE = 320;
    /**
     * 超时时间最大值
     */
    public static final Integer MAX_TIME_EXPIRE = 86400;

    /**
     * 传入的人民币最小值
     */
    public static final Integer MIN_AMOUNT = 1;

    /**
     * 佣金最小值为0
     */
    public static final Integer MIN_COMMISSION = 0;

    /**
     * 限制字符串长度
     */
    public static final Integer MAX_STRING_LENGTH_NO = 120;

    /**
     * 限制字符串长度
     */
    public static final Integer MAX_STRING_LENGTH_MESSAGE = 10;

    /**
     * 限制字符串长度
     */
    public static final Integer MAX_STRING_LENGTH_PRODUCT_NAME = 20;

    /**
     * 限制字符串长度
     */
    public static final Integer MAX_STRING_LENGTH_40 = 40;

    /**
     * 限制字符串长度
     */
    public static final Integer MAX_STRING_LENGTH_DESC = 60;

    /**
     * 结算最长日期 : 天
     */
    public static final Integer MAX_SETTLE_DAY = 60;

    /**
     * subject 长度限制
     */
    public static final Integer MAX_SUBJECT_LONG = 32;

    public static final Integer MAX_BODY_LONG = 128;

    public static final Long CASHIER_TIME_FIX =  60 * 1000L;
    /**
     * 默认分页偏移量
     */
    public static final Integer DEFAULT_PAGE_OFFSET = 0;
    /**
     * 默认分页大小
     */
    public static final Integer DEFAULT_PAGE_SIZE = 100;

    /**
     * 请求状态
     */
    public static final String SUBMITTED = "submitted";
    public static final String FAILED = "failed";
    public static final String SUCCEEDED = "succeeded";
    public static final String PAID = "paid";
    public static final String CANCELED = "canceled";
    public static final String REFUNDED = "refunded";
    public static final String CREATED = "created";
    /**
     * 大写
     */
    public static final String SUCCEEDED_CAP = "SUCCEEDED";
    /**
     * 签名验证错误
     */
    public static final String SIGN_ERROR = "sign_error";

    /**
     * 设置默认给Ping++传的客户请求地址
     */
    public static final String DEFAULT_CLIENT_IP = "192.168.1.75";

    /**
     * 平台标识
     */
    public static final String CHANNEL_WX_NAME = "wx";
    public static final String CHANNEL_ALI_NAME = "alipay";
    public static final String CHANNEL_AGGREGATE_NAME = "aggregate";
    public static final String CHANNEL_DIRECT_NAME = "direct";
    public static final String CHANNEL_DIRECT_NAME_WX = "directwx";
    public static final String CHANNEL_AGGREGATE_WX_NAME = "aggregate_wx";
    public static final String CHANNEL_DIRECT_NAME_ALIPAY = "directalipay";
    public static final String CHANNEL_CHINA_BANK_NAME = "chinabank";
    public static final String CHANNEL_FUMIN_BANK_NAME = "fm";
    public static final String CHANNEL_FUMIN_BANK_NAME_V2 = "fm_v2";
    public static final String CHANNEL_YBM_FUMIN_BANK_NAME = "ybmfm";
    public static final String CHANNEL_UPACP_NAME = "upacp";
    public static final String CHANNEL_UNIONPAY_NAME = "unionpay";
    public static final String CHANNEL_BALANCE_NAME = "balance_pay";
    public static final String CHANNEL_YOP_NAME = "yop";
    public static final String CHANNEL_PINGAN_NAME = "pingan";
    public static final String CHANNEL_JD_CARD_NAME = "jd_card";
    public static final String CHANNEL_JDAGGREGATE_NAME = "jdaggregate";
    public static final String CHANNEL_PINGAN_CREDIT = "pingan_credit";
    public static final String CHANNEL_JD_CREDIT = "jd_credit";
    public static final String CHANNEL_ABCHINA_LOAN = "abchina_loan";
    public static final String CHANNEL_XYD_LOAN = "xyd_loan";
    /**
     * 京东聚合支付默认过期时间：分钟
     */
    public static final String EXPIRE_JDAGGREGATE_TIME = "jdaggregate.expiretime";
    /**
     * handler内方法名 : 付款成功回调
     */
    public static final String METHOD_PAY_SUCCESS_NAME = "paySuccess";

    /**
     * handler内方法名 : 提现成功回调
     */
    public static final String METHOD_WITHDRAW_SUCCESS_NAME = "withdrawalSuccess";

    /**
     * handler内方法名 : 提现失败回调
     */
    public static final String METHOD_WITHDRAW_FAIL_NAME = "withdrawalFail";

    /**
     * handler内方法名 : 提现失败回调
     */
    public static final String METHOD_WITHDRAW_NAME = "withdrawal";

    /**
     * handler内方法名 : 渠道清分完成
     */
    public static final String METHOD_CLEAR__NAME = "clearSuccess";

    /**
     * handler内方法名 : 开户通知方法
     */
    public static final String METHOD_OPEN_ACCOUNT_NAME = "openAccount";

    /**
     * handler内方法名 : 退款成功回调
     */
    public static final String METHOD_REFUND_SUCCESS = "refund";
    /**
     * handler内方法名: 微信支付成功回调
     */
    public static final String METHOD_WXPAY_SUCCESS_NAME = "wxPaySuccess";
    /**
     * handler内方法名: 微信申请代扣成功回调
     */
    public static final String METHOD_WXPAPPAY_SUCCESS_NAME = "wxPapPaySuccess";
    /**
     * handler内方法名: 微信委托成功回调 -- 签约和解约
     */
    public static final String METHOD_WXENTRUST_SUCCESS_NAME = "wxEntrustSuccess";
    /**
     * handler内方法名: 支付宝支付成功回调
     */
    public static final String METHOD_ALIPAY_SUCCESS_NAME = "aliPaySuccess";
    /**
     * handler内方法名 : 分润成功回调
     */
    public static final String METHOD_ROYALTY_NAME = "pingxxRoyalty";

    /**
     * 微信回调业务成功标识
     */
    public static final String WX_CALLBACK_SUCCESS  = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
    /**
     * 微信回调业务失败标识
     */
    public static final String WX_CALLBACK_FAIL  = "<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";

    /**
     * 阿里回调业务成功标识
     */
    public static final String ALI_CALLBACK_SUCCESS = "success";

    /**
     * 阿里回调业务失败标识
     */
    public static final String ALI_CALLBACK_FAIL = "fail";

    /**
     * JD回调业务成功标识
     */
    public static final String JD_CALLBACK_SUCCESS = "success";
    /**
     * JD回调业务失败标识
     */
    public static final String JD_CALLBACK_FAIL = "fail";

    /**
     * JD回调业务成功标识
     */
    public static final String JDAGGREGATE_CALLBACK_SUCCESS = "SUCCESS";
    /**
     * JD回调业务成功标识
     */
    public static final String JDAGGREGATE_CALLBACK_ERROR = "ERROR";

    /**
     * Ping++回调业务成功标识
     */
    public static final String PINGXX_CALLBACK_SUCCESS = "success";

    /**
     * Ping++回调业务失败标识
     */
    public static final String PINGXX_CALLBACK_FAIL = "fail";

    /**
     * Ping++回调业务成功标识
     */
    public static final String CHINABANK_CALLBACK_SUCCESS = "SUCCESS";

    /**
     * Ping++回调业务失败标识
     */
    public static final String CHINABANK_CALLBACK_FAIL = "FAIL";
    /**
     * Ping++回调业务成功标识
     */
    public static final String FBANK_CALLBACK_SUCCESS = "{\"success\":\"true\"}";

    /**
     * 富民2.0接口返回成功标识
     */
    public static final String FBANK_CALLBACK_SUCCESS_V2 = "SUCCESS";
    /**
     * 平安成功
     */
    public static final String PINGAN_CALLBACK_SUCCESS = "notify_success";
    /**
     * 平安失败
     */
    public static final String PINGAN_CALLBACK_FAIL = "notify_fail";

    /**
     * Ping++回调业务失败标识
     */
    public static final String FBANK_CALLBACK_FAIL = "{\"success\":\"false\"}";

    /**
     * 富民2.0接口返回失败标识
     */
    public static final String FBANK_CALLBACK_FAIL_V2 = "FAILURE";

    /**
     * 银联回调业务成功标识
     */
    public static final String UNIONPAY_CALLBACK_SUCCESS = "success";

    /**
     * 银联回调业务失败标识
     */
    public static final String UNIONPAY_CALLBACK_FAIL = "fail";

    /**
     * 时间长度 单位：秒
     */
    public static final int ONE_DAY = 60*60*24;
    /**
     * 时间长度 单位：秒
     */
    public static final int ONE_HOUR = 60*60;
    /**
     * 时间长度 单位：秒
     */
    public static final int TEN_MINUTES = 60*10;
    /**
     * 新增
     */
    public static final String ADD = "00";

    public static final String UPDATE = "01";

    /**
     * 失败
     */
    public static final String FAIL = "FAIL";

    /**
     * 成功
     */
    public static final String SUCCESS = "success";

    /**
     * 退款中
     */
    public static final String REFUND_STATUS_PENDING = "pending";
    /**
     * 退款成功
     */
    public static final String REFUND_STATUS_SUCCEEDED = "succeeded";
    /**
     * 退款失败
     */
    public static final String REFUND_STATUS_FAILED = "failed";

    /**
     * 提现中
     */
    public static final String WITHDRAW_STATUS_PENDING = "pending";
    /**
     * 提现成功
     */
    public static final String WITHDRAW_STATUS_SUCCEEDED = "succeeded";
    /**
     * 提现失败
     */
    public static final String WITHDRAW_STATUS_FAILED = "failed";
    /**
     * 提现发起
     */
    public static final String WITHDRAW_STATUS_CREATE = "created";
    /**
     * 提现失败
     */
    public static final String WITHDRAW_STATUS_CANCEL = "canceled";

    /**
     * 200kb
     */
    public static final long TWO_HUNDRED_KB = 200*1024;


    /**
     * 是否开启验证签名
     */
    public static final String IS_SIGN = "isSign";

    /**
     * 他人代付是否转为北京药帮忙主体
     */
    public static final String OTHER_PAY_WX_TRANSTOBEIJING = "otherpay.wx.transtobeijing";

    public static final String CHANNEL_PINGXX_NAME = "pingxx";
    /**
     * 公钥名称
     */
    public static final String PUBLIC = ".public_key";

    /**
     * redis 订单退款 的 key 前缀
     */
    public static final String ORDER_REFUND_REDIS_KEY_PREFIX = "payment_order_refund_";

     /**
     * redis 订单退款 的 key 前缀
     */
    public static final String ORDER_CLOSED_REDIS_KEY_PREFIX = "payment:order:closed:";
    /**
     * redis 订单支付 payLoad 的 key 前缀
     */
    public static final String ORDER_PAY_LOAD_REDIS_KEY_PREFIX = "payment:order:payLoad:";
    /**
     * redis 订单支付 channelDegradedPay 的 key 前缀
     */
    public static final String ORDER_PAY_DEGRATE_REDIS_KEY_PREFIX = "payment:order:channelDegradedPay:";

    /**
     * redis 订单退清分 的 key 前缀
     */
    public static final String ORDER_REFUND_CLEARING_REDIS_KEY_PREFIX = "payment_order_refund_clearing_";

    /**
     * redis 订单清分 的 key 前缀
     */
    public static final String ORDER_CLEARING_REDIS_KEY_PREFIX = "payment_order_clearing_";

    /**
     * redis 订单结算失败列表的 key
     */
    public static final String PINGXX_ORDER_SETTLE_FAIL_REDIS_KEY = "pingxx_order_settle_fail";

    /**
     * redis 验证码的 key
     */
    public static final String ACTIVE_CODE_MSG_INFO = "active_code_msg_info_";

    /**
     * 一键签约银行卡缓存
     */
    public static final String ONE_KEY_SIGN_BANK = "one_key_sign_banks_";

    /**
     * redis 订单结算失败列表的 key 的过期时间
     */
    public static final int PINGXX_ORDER_SETTLE_FAIL_REDIS_KEY_EXPIRE = 60 * 60 * 24 * 7;

    public static final String WX_CARLLBACK_RATE_LIMITER_CREATE = "wx_callback_limit_create";

    public static final String PINGXX_CARLLBACK_RATE_LIMITER_CREATE = "pingxx_callback_limit_create";

    public static final String PAY_RATE_LIMITER_CREATE = "pay_limit_create";

    public static final String IDENTIFY_AUTH_LIMIT_CRATE = "identify_auth_limit_create";

    /** 京东支付 - 配置 **/
    public static final String JD_PAY_SETTING = "jd.pay.";
    /** 京东支付 商户号 - 配置 **/
    public static final String JD_PAY_MERCHANT_SETTING = "jd.pay.";
    /** 京东聚合支付 - 收银台 **/
    public static final String NAVIGATE_PATH_JDAGGREGATE = "navigate_path_jdaggregate";

    /**
     * 收银台地址信息
     */
    public static final String NAVIGATE_PATH = "navigate_path";

    /**
     * 中行支付开关
     */
    public static final String CHANNEL_CHINA_BANK_PAY_SWITCH = "channel_china_bank_pay_switch";

    /**
     * 京东聚合支付开关
     */
    public static final String CHANNEL_JDAGGREGATE_PAY_SWITCH = "channel_jdaggregate_pay_switch";

    /**
     * 富民支付开关
     */
    public static final String CHANNEL_FM_BANK_PAY_SWITCH = "channel_fm_bank_pay_switch";

    /**
     * 富民支付开关
     */
    public static final String CHANNEL_FM_BANK_PAY_SWITCH_EC_POP = "channel_fm_bank_pay_switch_ec_pop";

    /**
     * 平安支付开关
     */
    public static final String CHANNEL_PINGAN_PAY_SWITCH_EC_POP = "channel_pingan_pay_switch_ec_pop";

    /**
     * 平安支付开关
     */
    public static final String CHANNEL_PINGAN_PAY_SWITCH_EC_SELF = "channel_pingan_pay_switch_ec_self";

    /**
     * 易宝支付开关
     */
    public static final String CHANNEL_YOP_PAY_SWITCH = "channel_yop_pay_switch";

    /**
     * POP直连商户ID
     */
    public static final String POP_DIRECT_PAY_YBM_TECH_USER_ID = "pop_direct_pay_ybm_tech_user_id";
    /**
     * 平台商户ID
     */
    public static final String FBANK_YBM_TECH_ACCOUNT_ID = "fbank_ybm_tech_account_id";
    /**
     * 平台账户
     */
    public static final String FBANK_YBM_TECH_ACCOUNT_NO = "fbank_ybm_tech_account_no";
    /**
     * 武汉小药药结算户
     */
    public static final String FBANK_XYY_WH_ACCOUNT_ID = "fbank_xyy_wh_account_id";
    /**
     * 富民平台轮训户微信公众号走直连标识
     */
    public static final String FBANK_PLATFORM_PUB_DIRECT_PAY_SWITCH = "fbank_platform_pub_direct_pay_switch";
    /**
     * POP大商户切平安标识
     */
    public static final String EC_POP_BIG_SHOP_TO_PINGAN_SWITCH = "ec_pop_big_shop_to_pingan_switch";
    /**
     * POP大商户平安收款ID
     */
    public static final String EC_POP_BIG_SHOP_PINGAN_ACCOUNT_ID = "ec_pop_big_shop_pingan_account_id";
    /**
     * 平安汇总账户/平安挂账账户
     */
    public static final String EC_PINGAN_SUMMARY_ACCOUNT_ID = "ec_pingan_summary_account_id";
    /**
     * 平安退款账户
     */
    public static final String EC_PINGAN_REFUND_ACCOUNT_ID = "ec_pingan_refund_account_id";
    /**
     * 平安购物金账户
     */
    public static final String EC_PINGAN_BALANCE_ACCOUNT_ID = "ec_pingan_balance_account_id";
    /**
     * 平安营销账户
     */
    public static final String EC_PINGAN_MARKET_ACCOUNT_ID = "ec_pingan_market_account_id";
    /**
     * 平安退佣金账户
     */
    public static final String EC_PINGAN_OUT_BROKERAGE_ACCOUNT_ID = "ec_pingan_out_brokerage_account_id";
    /**
     * 平安收佣金账户
     */
    public static final String EC_PINGAN_IN_BROKERAGE_ACCOUNT_ID = "ec_pingan_in_brokerage_account_id";
    /**
     * 荷叶O2O平台商户ID
     */
    public static final String FBANK_HEYE_O2O_ACCOUNT_ID = "fbank_heye_o2o_account_id";
    /**
     * 荷叶国控平台商户ID
     */
    public static final String FBANK_HEYE_GK_ACCOUNT_ID = "fbank_heye_gk_account_id";
    /**
     * 荷叶富民支持支付模式
     */
    public static final String FBANK_HEYE_SUPPORT_PAY_MODE = "fbank_heye_support_pay_mode";
    /**
     * 荷叶富民灰度开关
     */
    public static final String FBANK_HEYE_GRAY_SWITCH = "fbank_heye_gray_switch";
    /**
     * 荷叶富民灰度店铺
     */
    public static final String FBANK_HEYE_GRAY_SHOPS = "fbank_heye_gray_shops";
    /**
     * 荷叶平台轮训账户
     */
    public static final String FBANK_HEYE_ACCOUNT_NO = "fbank_heye_account_no";



    /**
     * ping++ 各业务线的appid
     */
     public static final String PINGXX_BUSINESS_ORDER_APPID = "pingxx_business_order_appid";

    /**
     * ping++ 各业务线的appid
     */
    public static final String PINGXX_BUSINESS_ORDER_CONFIG = "pingxx_business_order_config";
    /**
     * chinaBank 各业务线的配置
     */
    public static final String BANK_BUSINESS_ORDER_CONFIG = "bank_business_order_config";

    /**
     * 去ping++ 灰度配置
     */
    public static final String CHANNEL_CONFIG = "channel_config";


    /**
     * H5 收银台地址
     */
    public static final String H5_CASHIER_ADDRESS_CONFIG = "h5_cashier_address_config";

    /**
     * httpClient 改造灰度
     */
    public static final String HTTP_CLIENT_TRANSFORM_KEY = "http_client_transform_key";

    /**
     * 验证类型 身份证
     */
    public static final String ID_CARD = "id_card";
    /**
     * 验证类型 银行卡
     */
    public static final String BANK_CARD = "bank_card";
    /**
     * 货币代码 目前只支持人民币
     * 人民币
     */
    public static final String CNY = "cny";
    /**
     * 子商户应用类型
     */
    public static final String MERCHANT = "merchant";
    /**
     * 个人应用类型
     */
    public static final String PERSONAL = "personal";
    /**
     * 个人提现卡
     */
    public static final String PERSONAL_WITHDRAW_CARD = "2";
    /**
     * 重庆富民银行
     */
    public static final String FUMIN_BANK_NAME = "重庆富民银行";

    /**
     * 提现限额 5万
     */
    public static final int WITHDRAWAL_AMOUNT_5W = 5000000;

    /**
     * 提现限额 20万
     */
    public static final int WITHDRAWAL_AMOUNT_20W = 20000000;

    //*************** 收银台 start *********************
    /**
     * 支付渠道支持的支付方式
     */
    public static final String CASHIER_CHANNEL = "cashier.paychannel.%s.%s";

    public static final String CASHIER_PAY_EXPIRE = "cashier.prepayorde.expire";
    //*************** 收银台 end ***********************

    /**
     * aeskey
     */
    public static final String AES_ENCRYPT_KEY = "aes.key";
    /**
     * 一账通
     */
    public static final String YIZHANGTONG = "yizhangtong";
    /**
     * 企富通
     */
    public static final String QIFUTONG = "qifutong";
    /**
     * 易宝
     */
    public static final String YOP = "yop";

    /**
     * 平安
     */
    public static final String PINGAN = "pingan";
    /**
     * 京东
     */
    public static final String JD = "jd";
    public static final String EC_BUSINESS_ORDER_TYPE_PREFIX = "ec";
    /**
     * 商户入驻数据加密
     */
    public static final String WARE_ENCRYPTION = "ware.encryption";
    /**
     * 商户入驻数据储存暂存前缀
     */
    public static final String MERCHANT_ENTRY= "merchant.entry";
    /**
     * 用户资料入库 key
     */
    public static final String USER_INFO_KEY = "user.info.key";

    public static final String withdrawalExtraMsg = "对公银行卡提现 |0-5万（含） 0.5元/笔| " +
            "|5-20万（不含） 5元/笔 （7*24）|  |20万以上（含） 6元/笔（工作日 9：00 - 17：00）|";


    /**
     * H5纯签约方式 缓存URL
     */
    public static final String ENTRUST_H5_KEY = "h5entrustweb::";

    /**
     * 订单关闭调用接口缓存
     */
    public static final String ORDER_CLOSE_KEY = "orderclose::";

    /**
     * 订单关闭渠道缓存
     */
    public static final String ORDER_CLOSE_CHANNEL_KEY = "orderclose::channel::";

    /**
     * 保留两位数的0
     */
    public static final String ZERO_000 = "0.00";

    /**
     * 修改账户信息入口
     */
    public static final String SOURCE_OPEN_ACCOUNT = "open_account";
    public static final String SOURCE_MODIFY_ACCOUNT = "modify_account";
    public static final String SOURCE_MODIFY_BANKCARD = "modify_bankcard";

    // 企业对公结算卡
    public static final String SETTLEMENT_CARD_TYPE_PUBLIC = "PUBLIC";
    // 企业对私结算卡
    public static final String SETTLEMENT_CARD_TYPE_PRIVATE = "PRIVATE";

    // 易宝成功CODE
    public static final String YOP_SUCCESS_CODE = "UA00000";
    public static final String YOP_UPLOAD_SUCCESS_CODE = "REG00000";
    public static final String YOP_CREATE_ACCOUNT_SUCCESS_CODE = "NIG00000";
    public static final String YOP_PAY_SUCCESS_CODE = "00000";
    public static final String YOP_REFUND_SUCCESS_CODE = "OPR00000";
    public static final String RECHARGE_REFUND_SEND = "rechargeRefundSend";

    /**
     * 日期格式 年 月 日 如20090226120000
     */
    public static final String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
    /**
     * 总单号前缀
     */
    public static final String TOTAL_ORDER_NUMBER_PREFIX = "T";

    /**
     * 京东支付渠道
     */
    public static final String JD_PAY_CHANNEL = "jdCredit";

    // 京东金融相关常量
    /**
     * 合作方编码
     */
    public static final String JD_CREDIT_PRODUCT_CODE="25199";
    public static final String JD_CREDIT_COMPANY_CODE="CoreXYY20240607";
    public static final String JD_CREDIT_PARTNER_CODE="TentXYY20240607";
    public static final String JD_CREDIT_REFUND_NOTIFY_KEY = "jdCredit.notifyUrl.refund";
    public static final String JD_CREDIT_REFUND_PAY_ACCOUNT_KEY = "jdCredit.refund.payAccountNo";
    public static final String JD_CREDIT_REFUND_PAY_ACCOUNT_NAME_KEY = "jdCredit.refund.payAccountName";
    public static final String JD_CREDIT_REFUND_PAY_OPEN_BANK_KEY = "jdCredit.refund.payOpenBank";
    //退款方式，固定值
    public static final String JD_CREDIT_REFUND_PAY_WAY = "JHT_GUARANTEE_REFUND_REPAY";

    //药帮忙账户信息
//    public static final String PAY_ACCOUNT_NAME = "北京药帮忙科技有限公司";
    /**
     * 用户收款账户号
     */
    public static final String RECEIVE_ACCOUNT_NO = "15000105536464";
    /**
     * 用户收款账户名称
     */
    public static final String RECEIVE_ACCOUNT_NAME = "重庆京东盛际小额贷款有限公司";

    public static final int PINGAN_CREDIT_PAY_JOB_OFFSET_DAY = 10;

    /**
     * 小雨点支付结算过期时间
     */
    public static final int XYD_CREDIT_PAY_JOB_OFFSET_DAY = 2;
    public static final int XYD_CREDIT_PAY_JOB_OFFSET_SECONDS = XYD_CREDIT_PAY_JOB_OFFSET_DAY * 86400;

    /**
     * 农行通知小药药订单状态
     */
    // 推送总行
    public static final Integer AB_CHINA_ORDER_STATUS_PUSH_BANK = Integer.valueOf(0);
    // 支付成功
    public static final Integer AB_CHINA_ORDER_STATUS_PAY_SUCCESS = Integer.valueOf(1);
    // 取消
    public static final Integer AB_CHINA_ORDER_STATUS_CANCEL = Integer.valueOf(2);

    /**
     * 小雨点渠道
     */
    // 主动查询授信结果
    public static final String XYD_CREDIT_RESULT = "查询用户授信结果";
    public static final String XYD_GET_FILE = "获取对账文件";
    public static final String XYD_QUERY_ACCOUNT_BALANCE = "查询账户余额";

    /**
     * 是否报送平安
     * 三方渠道通过平安清算，支付完成、退款完成需要报送平安
     */
    public static boolean thirdChannelSubmitPingan(String channel) {
        if (StringUtils.isBlank(channel)) {
            return false;
        }
        if (CHANNEL_JD_CARD_NAME.equals(channel) || channel.startsWith(CHANNEL_JDAGGREGATE_NAME)) {
            log.info("三方渠道[{}]需报送平安", channel);
            return true;
        }
        return false;
    }

    public static String convertPayChannelToChannel(String payChannel, String businessType) {
        String channel;
        // 若为京东银行卡支付，则传递原channel
        if (thirdChannelSubmitPingan(payChannel) || BusinessIdTypeEnum.EC.getType().equals(businessType)) {
            channel = payChannel;
        } else if (ChannelEnum.JD_CREDIT.getCode().equals(payChannel)) {
            channel = payChannel;
        } else {
            if (payChannel.contains("_")) {
                channel = Constants.CHANNEL_AGGREGATE_NAME + "_" + payChannel.split("_")[1];
            } else {
                channel = Constants.CHANNEL_AGGREGATE_NAME + "_" + payChannel;
            }
        }
        return channel;
    }

    /**
     * 转换三方渠道报送平安的渠道
     */
    public static String transThirdCahnnelSubmitPingan(String channel) {
        if (StringUtils.isBlank(channel)) {
            return channel;
        }
        if (CHANNEL_JD_CARD_NAME.equals(channel)) {
            return channel;
        }
        if (channel.startsWith(CHANNEL_JDAGGREGATE_NAME)) {
            return CHANNEL_JDAGGREGATE_NAME;
        }
        return channel;
    }

    public static final String REFUND_ROUTE_TIPS_XYD_LOAN = "转入平安商户";

}
